#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAXN = 2e3+10;
const int mod = 998244353;

int n,k,x[MAXN],y[MAXN];
ll ans;

ll qp(ll x,int t){ll res = 1;for(;t;t>>=1,x=x*x%mod)if(t&1)res=res*x%mod;return res;}

int main (){
	scanf("%d %d",&n,&k);for(int i = 1;i <= n;i++) scanf("%d %d",&x[i],&y[i]);
	for(int i = 1;i <= n;i++){
		ll s1 = y[i] % mod,s2 = 1;
		for(int j = 1;j <= n;j++){
			if(i == j) continue;
			s1 = s1 * (k-x[j]) % mod; s2 = s2 * (x[i] - x[j]) % mod;
		}
		ans = (ans + s1 * qp(s2,mod-2) % mod) % mod;
	}ans = (ans % mod + mod) % mod;
	printf("%lld\n",ans);return 0;
}
